// **********************************************************************
//
// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.3.0
// Generated from file `channel.ice'

#include <channel.hh>
#include <Ice/LocalException.h>
#include <Ice/ObjectFactory.h>
#include <Ice/BasicStream.h>
#include <IceUtil/Iterator.h>
#include <IceUtil/ScopedArray.h>

#ifndef ICE_IGNORE_VERSION
#   if ICE_INT_VERSION / 100 != 303
#       error Ice version mismatch!
#   endif
#   if ICE_INT_VERSION % 100 > 50
#       error Beta header file detected
#   endif
#   if ICE_INT_VERSION % 100 < 0
#       error Ice patch level mismatch!
#   endif
#endif

static const ::std::string __asterisk__bridge__channel__getbyname_name = "getbyname";

static const ::std::string __asterisk__bridge__channel__getbyexten_name = "getbyexten";

static const ::std::string __asterisk__bridge__channel__get_name = "get";

::Ice::Object* IceInternal::upCast(::asterisk::bridge::channel* p) { return p; }
::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy::asterisk::bridge::channel* p) { return p; }

::Ice::Object* IceInternal::upCast(::asterisk::bridge::sip::channel* p) { return p; }
::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy::asterisk::bridge::sip::channel* p) { return p; }

void
asterisk::bridge::__read(::IceInternal::BasicStream* __is, ::asterisk::bridge::channelPrx& v)
{
    ::Ice::ObjectPrx proxy;
    __is->read(proxy);
    if(!proxy)
    {
        v = 0;
    }
    else
    {
        v = new ::IceProxy::asterisk::bridge::channel;
        v->__copyFrom(proxy);
    }
}

void
asterisk::bridge::sip::__read(::IceInternal::BasicStream* __is, ::asterisk::bridge::sip::channelPrx& v)
{
    ::Ice::ObjectPrx proxy;
    __is->read(proxy);
    if(!proxy)
    {
        v = 0;
    }
    else
    {
        v = new ::IceProxy::asterisk::bridge::sip::channel;
        v->__copyFrom(proxy);
    }
}

bool
asterisk::type::basic::cdr::operator==(const cdr& __rhs) const
{
    if(this == &__rhs)
    {
        return true;
    }
    if(src != __rhs.src)
    {
        return false;
    }
    if(dst != __rhs.dst)
    {
        return false;
    }
    if(billsec != __rhs.billsec)
    {
        return false;
    }
    if(duration != __rhs.duration)
    {
        return false;
    }
    return true;
}

bool
asterisk::type::basic::cdr::operator<(const cdr& __rhs) const
{
    if(this == &__rhs)
    {
        return false;
    }
    if(src < __rhs.src)
    {
        return true;
    }
    else if(__rhs.src < src)
    {
        return false;
    }
    if(dst < __rhs.dst)
    {
        return true;
    }
    else if(__rhs.dst < dst)
    {
        return false;
    }
    if(billsec < __rhs.billsec)
    {
        return true;
    }
    else if(__rhs.billsec < billsec)
    {
        return false;
    }
    if(duration < __rhs.duration)
    {
        return true;
    }
    else if(__rhs.duration < duration)
    {
        return false;
    }
    return false;
}

void
asterisk::type::basic::cdr::__write(::IceInternal::BasicStream* __os) const
{
    __os->write(src);
    __os->write(dst);
    __os->write(billsec);
    __os->write(duration);
}

void
asterisk::type::basic::cdr::__read(::IceInternal::BasicStream* __is)
{
    __is->read(src);
    __is->read(dst);
    __is->read(billsec);
    __is->read(duration);
}

bool
asterisk::type::basic::channel::operator==(const channel& __rhs) const
{
    if(this == &__rhs)
    {
        return true;
    }
    if(name != __rhs.name)
    {
        return false;
    }
    if(exten != __rhs.exten)
    {
        return false;
    }
    if(cdr != __rhs.cdr)
    {
        return false;
    }
    if(bridged != __rhs.bridged)
    {
        return false;
    }
    return true;
}

bool
asterisk::type::basic::channel::operator<(const channel& __rhs) const
{
    if(this == &__rhs)
    {
        return false;
    }
    if(name < __rhs.name)
    {
        return true;
    }
    else if(__rhs.name < name)
    {
        return false;
    }
    if(exten < __rhs.exten)
    {
        return true;
    }
    else if(__rhs.exten < exten)
    {
        return false;
    }
    if(cdr < __rhs.cdr)
    {
        return true;
    }
    else if(__rhs.cdr < cdr)
    {
        return false;
    }
    if(bridged < __rhs.bridged)
    {
        return true;
    }
    else if(__rhs.bridged < bridged)
    {
        return false;
    }
    return false;
}

void
asterisk::type::basic::channel::__write(::IceInternal::BasicStream* __os) const
{
    __os->write(name);
    __os->write(exten);
    cdr.__write(__os);
    __os->write(bridged);
}

void
asterisk::type::basic::channel::__read(::IceInternal::BasicStream* __is)
{
    __is->read(name);
    __is->read(exten);
    cdr.__read(__is);
    __is->read(bridged);
}

void
asterisk::type::comp::list::__writechannel(::IceInternal::BasicStream* __os, const ::asterisk::type::basic::channel* begin, const ::asterisk::type::basic::channel* end)
{
    ::Ice::Int size = static_cast< ::Ice::Int>(end - begin);
    __os->writeSize(size);
    for(int i = 0; i < size; ++i)
    {
        begin[i].__write(__os);
    }
}

void
asterisk::type::comp::list::__readchannel(::IceInternal::BasicStream* __is, ::asterisk::type::comp::list::channel& v)
{
    ::Ice::Int sz;
    __is->readSize(sz);
    __is->startSeq(sz, 21);
    v.resize(sz);
    for(int i = 0; i < sz; ++i)
    {
        v[i].__read(__is);
        __is->checkSeq();
        __is->endElement();
    }
    __is->endSeq(sz);
}

::asterisk::type::basic::channel
IceProxy::asterisk::bridge::channel::getbyname(const ::std::string& name, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
            __checkTwowayOnly(__asterisk__bridge__channel__getbyname_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::asterisk::bridge::channel* __del = dynamic_cast< ::IceDelegate::asterisk::bridge::channel*>(__delBase.get());
            return __del->getbyname(name, __ctx);
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

::asterisk::type::basic::channel
IceProxy::asterisk::bridge::channel::getbyexten(const ::std::string& exten, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
            __checkTwowayOnly(__asterisk__bridge__channel__getbyexten_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::asterisk::bridge::channel* __del = dynamic_cast< ::IceDelegate::asterisk::bridge::channel*>(__delBase.get());
            return __del->getbyexten(exten, __ctx);
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

::asterisk::type::comp::list::channel
IceProxy::asterisk::bridge::channel::get(const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
            __checkTwowayOnly(__asterisk__bridge__channel__get_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::asterisk::bridge::channel* __del = dynamic_cast< ::IceDelegate::asterisk::bridge::channel*>(__delBase.get());
            return __del->get(__ctx);
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

const ::std::string&
IceProxy::asterisk::bridge::channel::ice_staticId()
{
    return ::asterisk::bridge::channel::ice_staticId();
}

::IceInternal::Handle< ::IceDelegateM::Ice::Object>
IceProxy::asterisk::bridge::channel::__createDelegateM()
{
    return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::asterisk::bridge::channel);
}

::IceInternal::Handle< ::IceDelegateD::Ice::Object>
IceProxy::asterisk::bridge::channel::__createDelegateD()
{
    return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::asterisk::bridge::channel);
}

::IceProxy::Ice::Object*
IceProxy::asterisk::bridge::channel::__newInstance() const
{
    return new channel;
}

const ::std::string&
IceProxy::asterisk::bridge::sip::channel::ice_staticId()
{
    return ::asterisk::bridge::sip::channel::ice_staticId();
}

::IceInternal::Handle< ::IceDelegateM::Ice::Object>
IceProxy::asterisk::bridge::sip::channel::__createDelegateM()
{
    return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::asterisk::bridge::sip::channel);
}

::IceInternal::Handle< ::IceDelegateD::Ice::Object>
IceProxy::asterisk::bridge::sip::channel::__createDelegateD()
{
    return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::asterisk::bridge::sip::channel);
}

::IceProxy::Ice::Object*
IceProxy::asterisk::bridge::sip::channel::__newInstance() const
{
    return new channel;
}

::asterisk::type::basic::channel
IceDelegateM::asterisk::bridge::channel::getbyname(const ::std::string& name, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __asterisk__bridge__channel__getbyname_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(name);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::asterisk::type::basic::channel __ret;
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        __ret.__read(__is);
        __is->endReadEncaps();
        return __ret;
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

::asterisk::type::basic::channel
IceDelegateM::asterisk::bridge::channel::getbyexten(const ::std::string& exten, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __asterisk__bridge__channel__getbyexten_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(exten);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::asterisk::type::basic::channel __ret;
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        __ret.__read(__is);
        __is->endReadEncaps();
        return __ret;
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

::asterisk::type::comp::list::channel
IceDelegateM::asterisk::bridge::channel::get(const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __asterisk__bridge__channel__get_name, ::Ice::Normal, __context);
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::asterisk::type::comp::list::channel __ret;
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        ::asterisk::type::comp::list::__readchannel(__is, __ret);
        __is->endReadEncaps();
        return __ret;
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

::asterisk::type::basic::channel
IceDelegateD::asterisk::bridge::channel::getbyname(const ::std::string& name, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::asterisk::type::basic::channel& __result, const ::std::string& name, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _result(__result),
            _m_name(name)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::asterisk::bridge::channel* servant = dynamic_cast< ::asterisk::bridge::channel*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            _result = servant->getbyname(_m_name, _current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        ::asterisk::type::basic::channel& _result;
        const ::std::string& _m_name;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __asterisk__bridge__channel__getbyname_name, ::Ice::Normal, __context);
    ::asterisk::type::basic::channel __result;
    try
    {
        _DirectI __direct(__result, name, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
    return __result;
}

::asterisk::type::basic::channel
IceDelegateD::asterisk::bridge::channel::getbyexten(const ::std::string& exten, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::asterisk::type::basic::channel& __result, const ::std::string& exten, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _result(__result),
            _m_exten(exten)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::asterisk::bridge::channel* servant = dynamic_cast< ::asterisk::bridge::channel*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            _result = servant->getbyexten(_m_exten, _current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        ::asterisk::type::basic::channel& _result;
        const ::std::string& _m_exten;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __asterisk__bridge__channel__getbyexten_name, ::Ice::Normal, __context);
    ::asterisk::type::basic::channel __result;
    try
    {
        _DirectI __direct(__result, exten, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
    return __result;
}

::asterisk::type::comp::list::channel
IceDelegateD::asterisk::bridge::channel::get(const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::asterisk::type::comp::list::channel& __result, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _result(__result)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::asterisk::bridge::channel* servant = dynamic_cast< ::asterisk::bridge::channel*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            _result = servant->get(_current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        ::asterisk::type::comp::list::channel& _result;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __asterisk__bridge__channel__get_name, ::Ice::Normal, __context);
    ::asterisk::type::comp::list::channel __result;
    try
    {
        _DirectI __direct(__result, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
    return __result;
}

::Ice::ObjectPtr
asterisk::bridge::channel::ice_clone() const
{
    throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);
    return 0; // to avoid a warning with some compilers
}

static const ::std::string __asterisk__bridge__channel_ids[2] =
{
    "::Ice::Object",
    "::asterisk::bridge::channel"
};

bool
asterisk::bridge::channel::ice_isA(const ::std::string& _s, const ::Ice::Current&) const
{
    return ::std::binary_search(__asterisk__bridge__channel_ids, __asterisk__bridge__channel_ids + 2, _s);
}

::std::vector< ::std::string>
asterisk::bridge::channel::ice_ids(const ::Ice::Current&) const
{
    return ::std::vector< ::std::string>(&__asterisk__bridge__channel_ids[0], &__asterisk__bridge__channel_ids[2]);
}

const ::std::string&
asterisk::bridge::channel::ice_id(const ::Ice::Current&) const
{
    return __asterisk__bridge__channel_ids[1];
}

const ::std::string&
asterisk::bridge::channel::ice_staticId()
{
    return __asterisk__bridge__channel_ids[1];
}

::Ice::DispatchStatus
asterisk::bridge::channel::___getbyname(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::std::string name;
    __is->read(name);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::asterisk::type::basic::channel __ret = getbyname(name, __current);
    __ret.__write(__os);
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
asterisk::bridge::channel::___getbyexten(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::std::string exten;
    __is->read(exten);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::asterisk::type::basic::channel __ret = getbyexten(exten, __current);
    __ret.__write(__os);
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
asterisk::bridge::channel::___get(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    __inS.is()->skipEmptyEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::asterisk::type::comp::list::channel __ret = get(__current);
    if(__ret.size() == 0)
    {
        __os->writeSize(0);
    }
    else
    {
        ::asterisk::type::comp::list::__writechannel(__os, &__ret[0], &__ret[0] + __ret.size());
    }
    return ::Ice::DispatchOK;
}

static ::std::string __asterisk__bridge__channel_all[] =
{
    "get",
    "getbyexten",
    "getbyname",
    "ice_id",
    "ice_ids",
    "ice_isA",
    "ice_ping"
};

::Ice::DispatchStatus
asterisk::bridge::channel::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
{
    ::std::pair< ::std::string*, ::std::string*> r = ::std::equal_range(__asterisk__bridge__channel_all, __asterisk__bridge__channel_all + 7, current.operation);
    if(r.first == r.second)
    {
        throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
    }

    switch(r.first - __asterisk__bridge__channel_all)
    {
        case 0:
        {
            return ___get(in, current);
        }
        case 1:
        {
            return ___getbyexten(in, current);
        }
        case 2:
        {
            return ___getbyname(in, current);
        }
        case 3:
        {
            return ___ice_id(in, current);
        }
        case 4:
        {
            return ___ice_ids(in, current);
        }
        case 5:
        {
            return ___ice_isA(in, current);
        }
        case 6:
        {
            return ___ice_ping(in, current);
        }
    }

    assert(false);
    throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
}

void
asterisk::bridge::channel::__write(::IceInternal::BasicStream* __os) const
{
    __os->writeTypeId(ice_staticId());
    __os->startWriteSlice();
    __os->endWriteSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__write(__os);
#else
    ::Ice::Object::__write(__os);
#endif
}

void
asterisk::bridge::channel::__read(::IceInternal::BasicStream* __is, bool __rid)
{
    if(__rid)
    {
        ::std::string myId;
        __is->readTypeId(myId);
    }
    __is->startReadSlice();
    __is->endReadSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__read(__is, true);
#else
    ::Ice::Object::__read(__is, true);
#endif
}

void
asterisk::bridge::channel::__write(const ::Ice::OutputStreamPtr&) const
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type asterisk::bridge::channel was not generated with stream support";
    throw ex;
}

void
asterisk::bridge::channel::__read(const ::Ice::InputStreamPtr&, bool)
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type asterisk::bridge::channel was not generated with stream support";
    throw ex;
}

void 
asterisk::bridge::__patch__channelPtr(void* __addr, ::Ice::ObjectPtr& v)
{
    ::asterisk::bridge::channelPtr* p = static_cast< ::asterisk::bridge::channelPtr*>(__addr);
    assert(p);
    *p = ::asterisk::bridge::channelPtr::dynamicCast(v);
    if(v && !*p)
    {
        IceInternal::Ex::throwUOE(::asterisk::bridge::channel::ice_staticId(), v->ice_id());
    }
}

bool
asterisk::bridge::operator==(const ::asterisk::bridge::channel& l, const ::asterisk::bridge::channel& r)
{
    return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);
}

bool
asterisk::bridge::operator<(const ::asterisk::bridge::channel& l, const ::asterisk::bridge::channel& r)
{
    return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);
}

::Ice::ObjectPtr
asterisk::bridge::sip::channel::ice_clone() const
{
    throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);
    return 0; // to avoid a warning with some compilers
}

static const ::std::string __asterisk__bridge__sip__channel_ids[2] =
{
    "::Ice::Object",
    "::asterisk::bridge::sip::channel"
};

bool
asterisk::bridge::sip::channel::ice_isA(const ::std::string& _s, const ::Ice::Current&) const
{
    return ::std::binary_search(__asterisk__bridge__sip__channel_ids, __asterisk__bridge__sip__channel_ids + 2, _s);
}

::std::vector< ::std::string>
asterisk::bridge::sip::channel::ice_ids(const ::Ice::Current&) const
{
    return ::std::vector< ::std::string>(&__asterisk__bridge__sip__channel_ids[0], &__asterisk__bridge__sip__channel_ids[2]);
}

const ::std::string&
asterisk::bridge::sip::channel::ice_id(const ::Ice::Current&) const
{
    return __asterisk__bridge__sip__channel_ids[1];
}

const ::std::string&
asterisk::bridge::sip::channel::ice_staticId()
{
    return __asterisk__bridge__sip__channel_ids[1];
}

void
asterisk::bridge::sip::channel::__write(::IceInternal::BasicStream* __os) const
{
    __os->writeTypeId(ice_staticId());
    __os->startWriteSlice();
    __os->endWriteSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__write(__os);
#else
    ::Ice::Object::__write(__os);
#endif
}

void
asterisk::bridge::sip::channel::__read(::IceInternal::BasicStream* __is, bool __rid)
{
    if(__rid)
    {
        ::std::string myId;
        __is->readTypeId(myId);
    }
    __is->startReadSlice();
    __is->endReadSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__read(__is, true);
#else
    ::Ice::Object::__read(__is, true);
#endif
}

void
asterisk::bridge::sip::channel::__write(const ::Ice::OutputStreamPtr&) const
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type asterisk::bridge::sip::channel was not generated with stream support";
    throw ex;
}

void
asterisk::bridge::sip::channel::__read(const ::Ice::InputStreamPtr&, bool)
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type asterisk::bridge::sip::channel was not generated with stream support";
    throw ex;
}

void 
asterisk::bridge::sip::__patch__channelPtr(void* __addr, ::Ice::ObjectPtr& v)
{
    ::asterisk::bridge::sip::channelPtr* p = static_cast< ::asterisk::bridge::sip::channelPtr*>(__addr);
    assert(p);
    *p = ::asterisk::bridge::sip::channelPtr::dynamicCast(v);
    if(v && !*p)
    {
        IceInternal::Ex::throwUOE(::asterisk::bridge::sip::channel::ice_staticId(), v->ice_id());
    }
}

bool
asterisk::bridge::sip::operator==(const ::asterisk::bridge::sip::channel& l, const ::asterisk::bridge::sip::channel& r)
{
    return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);
}

bool
asterisk::bridge::sip::operator<(const ::asterisk::bridge::sip::channel& l, const ::asterisk::bridge::sip::channel& r)
{
    return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);
}
